package com.catal.framework.data;


public class Or extends Condition{

	private Condition leftCondition;
	
	private Condition rightCondition;
	
	private String orDesc;
	
	public Or() {
		super();
	}
	

	/**
	 * @param leftCondition
	 *            or左边源条件
	 * @param rightCondition
	 *            or右边的条件
	 */
	public Or(Condition leftCondition, Condition rightCondition) {
		this.leftCondition = leftCondition;
		this.rightCondition = rightCondition;
	}
	

	public String toString(){
		StringBuffer buffer = new StringBuffer("((");
		buffer.append(this.leftCondition.toString() + ")");
		buffer.append(" OR ").append("("+rightCondition+")");
		buffer.append(")");
		return buffer.toString();
	}
	
	public Condition getLeftCondition() {
		return leftCondition;
	}


	public void setLeftCondition(Condition leftCondition) {
		this.leftCondition = leftCondition;
	}


	public Condition getRightCondition() {
		return rightCondition;
	}


	public void setRightCondition(Condition rightCondition) {
		this.rightCondition = rightCondition;
	}
	

	public String getOrDesc() {
		return orDesc;
	}


	public void setOrDesc(String orDesc) {
		this.orDesc = orDesc;
	}
	
	public static void main(String[] args) {
		Condition con1 = new Condition("t.a", ConditionOperSign.GE,"1");
		Condition con2 = new Condition("t.a", ConditionOperSign.LE,"10");
		And and = new And(con1, con2);
		Condition con3 = new Condition("t.b", ConditionOperSign.BETWEEN, "10","100");
		Or or = new Or(and, con3);
		System.out.println(or);
	}
}
